package modele.WorldElem;

import java.awt.Color;
import java.util.Random;

import modele.Square;
import modele.World;

import controller.Rule;
import controller.Visitor;

public class Grass extends State{
	
	public final static int TOTREE = 300;
	
	public Grass(){
		super();
		Random r = new Random();
	}
	
	public Grass(SecondaryState ss){
		super(ss);
	}
	

	@Override
	public void accept(Visitor v) {
		v.visit(this);
		
	}

	@Override
	public void evolve(Square s, World w) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getState() {
		return State.GRASS;
	}

	@Override
	public int getStateAdditionalAltitude() {
		return 0;
	}

	@Override
	public Color getColor(Square s) {
		if(this.getSecondaryStateValue()!= SecondaryState.NONE) return this.getSecondaryState().getColor(s);
		return new Color(124,252,(int)(0+s.getAltitude())/2);
	}

	@Override
	public void applyRule(Rule r, Square s, World w) {
		r.applyRule(this, s);
	}
	
	@Override
	public Object clone() {
		return new Grass((SecondaryState)getSecondaryState().clone());
	}

}
